﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/RedesignedMaster.Master" Inherits="System.Web.Mvc.ViewPage<List<final_darskade.Models.course>>" %>

<asp:Content ID="titleContent" ContentPlaceHolderID="TitleContent" runat="server">
	لیست دروس
</asp:Content>

<asp:Content ID = "breadcrumb" ContentPlaceHolderID = "Breadcrumbs" runat = "server">
    <a href = "/">صفحه اصلی</a> > <a href = "/Course/">مدیریت دروس</a>
</asp:Content>

<asp:Content ID = "headContent" ContentPlaceHolderID = "HeadContent" runat = "server">
    <script type = "text/javascript">
        $(document).ready(function () {
            $("#button").mouseover(function () {
                document.getElementById("button").style.backgroundColor = "#a00";
            });

            $("#button").mouseout(function () {
                document.getElementById("button").style.backgroundColor = "#2ae";
            });
        });
    </script>
</asp:Content>

<asp:Content ID="mainContent" ContentPlaceHolderID="MainContent" runat="server">

    <div>
        <a href = "/Course/Create">ثبت درس جدید</a>
    </div>

    <div>
    <form method = "post" class = "validateform searchform" action = "FullSearch">
        <fieldset>
            <legend><b>+</b> جستجوی درس</legend>
            <span class = "formcontent">
                از شماره:<input id = "start" name = "start" class = "validate[optional,custom[farsinumber]] farsinumber" size = 4/>
                &nbsp;تا شماره:<input id = "end" name = "end" class = "validate[optional,custom[farsinumber]] farsinumber" size = 4/>
                &nbsp;نام درس:<input name = "name" size = "12"/>
                &nbsp;رشته:<input name = "field" size = "12"/>
                &nbsp;تعداد واحد:<input id = "unit" name = "unit" class = "validate[optional,custom[farsinumber]] farsinumber" size = 2/>
                <input id = "button" class = "button" type = "submit" value = "جستجو"/>
            </span>
        </fieldset>
    </form>
    </div>

    <%if (false == Model.Any()) { %>
        <span style="color:Red">هیچ موردی یافت نشد.</span>
    <% } else { %>
        <table>
            <thead>
            <tr>
                <th scope = "col">شماره درس</th>
                <th scope = "col">نام درس</th>
                <th scope = "col">رشته</th>
                <th scope = "col">تعداد واحد</th>
                <th scope = "col">تنظیمات درس</th>
            </tr>
            </thead>
            <tbody>
            <%foreach (var course in Model){%>
                  <tr>
                        <td><%=course.course_id %></td>
                        <td><%=course.name %></td>
                        <td><%=course.field %></td>
                        <td><%=course.unit %></td>
                        <td><a href = "/Course/Edit?course_id=<%=course.course_id%>">ویرایش</a> &nbsp;|&nbsp;
                            <a href = "/Course/Delete?course_id=<%=course.course_id%>">حذف</a></td>
                    </tr>
            <% } %>
            </tbody>
        </table>
    <% } %>
</asp:Content>